package com.glsc.ngateway.common.base.domain.mysql.gateway.other;


import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.glsc.ngateway.common.api.common.enums.DictConstant;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @Author: libj
 * @Date: 2022/6/27
 * @Desc: 数字证书信息表
 */
@Data
@MappedSuperclass
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonIgnoreProperties({ "hibernateLazyInitializer", "handler" })
public class BaseDigitalKey implements Serializable {
    @ApiModelProperty(value = "发证机构")
    @Column(name = "key_issue_branch", columnDefinition = "varchar(200) COMMENT '发证机构'")
    protected String keyIssueBranch;

    @ApiModelProperty(value = "对应平台")
    @Column(name = "key_platform", columnDefinition = "varchar(200) COMMENT '对应平台'")
    protected String keyPlatform;

    @ApiModelProperty(value = "证书有效期 格式：yyyy-MM-dd")
    @Column(name = "key_expire_date", columnDefinition = "varchar(10) COMMENT '证书有效期 格式：yyyy-MM-dd'")
    protected String keyExpireDate;

    @ApiModelProperty(value = "使用部门")
    @Column(name = "use_department", columnDefinition = "varchar(100) COMMENT '使用部门'")
    protected String useDepartment;

    @ApiModelProperty(value = "托管人所在部门名称")
    @Column(name = "custodian_dept_name", columnDefinition = "varchar(100) COMMENT '托管人所在部门名称'")
    protected String custodianDeptName;

    @ApiModelProperty(value = "托管人所在部门id")
    @Column(name = "custodian_dept_id", columnDefinition = "varchar(100) COMMENT '托管人所在部门id'")
    protected String custodianDeptId;

    @ApiModelProperty(value = "用途")
    @Column(name = "use_desc", columnDefinition = "text COMMENT '用途'")
    protected String useDesc;

    @ApiModelProperty(value = "证书序列号")
    @Column(name = "key_no", columnDefinition = "varchar(100) COMMENT '证书序列号'")
    protected String keyNo;

    @ApiModelProperty(value = "备注")
    @Column(name = "remark", columnDefinition = "text COMMENT '备注'")
    protected String remark;

    @ApiModelProperty(value = "状态 是否在用 字典： am_digital_key_status")
    @Column(name = "key_status", columnDefinition = "varchar(10) COMMENT '状态 是否在用 字典： am_digital_key_status'")
    protected String keyStatus;

    @ApiModelProperty(value = "是否已经提醒，字典 yesno （N=未提醒(默认) Y=已提醒)")
    @Column(name = "has_remind", columnDefinition = "varchar(10) COMMENT '是否已经提醒，字典 yesno （N=未提醒(默认) Y=已提醒)'")
    protected String hasRemind = DictConstant.NO;

    @ApiModelProperty(value = "删除状态，字典 字典 yesno （N=否(默认) Y=是)")
    @Column(name = "key_deleted", columnDefinition = "varchar(10) COMMENT '删除状态字典 字典 yesno （N=否(默认) Y=是)'")
    protected String keyDeleted = DictConstant.NO;

    @ApiModelProperty(value = "创建时间 yyyy-MM-dd HH:mm:ss")
    @Column(name = "create_time", columnDefinition = "datetime comment '创建时间'")
    @org.hibernate.annotations.CreationTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    protected LocalDateTime createTime;

    @ApiModelProperty(value = "创建人ID")
    @Column(name = "create_operator", columnDefinition = "varchar(20) COMMENT '创建人ID'")
    protected String createOperator;

    @ApiModelProperty(value = "创建人姓名")
    @Column(name = "create_operator_name", columnDefinition = "varchar(20) COMMENT '创建人姓名'")
    protected String createOperatorName;

    //操作人员信息
    @ApiModelProperty(value = "操作来源")
    @Column(name = "op_source", columnDefinition = "varchar(32) COMMENT '操作来源'")
    protected String opSource;

    @ApiModelProperty(value = "操作动作(增加、修改)")
    @Column(name = "op_action", columnDefinition = "varchar(32) COMMENT '操作动作(增加、修改)'")
    protected String opAction;

    @ApiModelProperty(value = "操作人员ID")
    @Column(name = "op_operator", columnDefinition = "varchar(20) COMMENT '操作人员ID'")
    protected String opOperator;

    @ApiModelProperty(value = "操作人员姓名")
    @Column(name = "op_operator_name", columnDefinition = "varchar(20) COMMENT '操作人员姓名'")
    protected String opOperatorName;

    @ApiModelProperty(value = "操作时间")
    @Column(name = "op_time", columnDefinition = "datetime comment '操作时间'")
    @org.hibernate.annotations.UpdateTimestamp
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    @JsonDeserialize(using = LocalDateTimeDeserializer.class)
    protected LocalDateTime opTime;
}

